﻿using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using System;
using System.Threading.Tasks;
using VisionCloud.Domain.Common;
using VisionCloud.Domain.DtoModel.Applet.RequestDto;
using VisionCloud.Domain.DtoModel.Applet.ResponseDto;
using VisionCloud.Domain.Filters;
using VisionCloud.Service.Applet;

namespace VisionCloud.Api.Controllers.Applet
{
    /// <summary>
    /// 报告相关
    /// </summary>
    [SystemModule("小程序模块")]
    [ApiAuthorize(PolicyEnum.RequireRolePermission)]
    [ApiVersion("1.0")]
    [Route("api/applet/[controller]/[Action]")]
    [ApiExplorerSettings(GroupName = "小程序模块")]
    public class ReportController : ApiBaseController
    {
        public ReportService ReportService { get; set; }

        /// <summary>
        /// 获取查询条件
        /// </summary>
        [HttpPost]
        [SwaggerResponse(0, "获取详情数据的字段：Result", typeof(ApiResultBase<PointReportConditionDto>))]
        public async Task<ApiResult> GetPointReportCondition(QueryReportConditionDto condition)
        {
            return await TryCatchAsync(ReportService.GetPointReportCondition(condition));
        }

        /// <summary>
        /// 获取户型图站点信息
        /// </summary>
        [HttpPost]
        [SwaggerResponse(0, "获取详情数据的字段：Result", typeof(ApiResultBase<HouseMapPointsdto>))]
        public async Task<ApiResult> GetHouseMapPoints(QueryHouseMapDto condition)
        {
            return await TryCatchAsync(ReportService.GetHouseMapPoints(condition));
        }

        /// <summary>
        /// 获取站点报告列表
        /// </summary>
        [HttpPost]
        [SwaggerResponse(0, "获取详情数据的字段：Result", typeof(ApiResultBase<PointReportListDto>))]
        public async Task<ApiResult> GetPointReports(QueryPointReportDto condition)
        {
            return await TryCatchAsync(ReportService.GetPointReports(condition));
        }

        /// <summary>
        /// 获取最近生成报告数据（默认近一周报告数据）
        /// </summary>
        [HttpPost]
        [SwaggerResponse(0, "获取详情数据的字段：Result", typeof(ApiResultBase<WxRecentlyReportResponse>))]
        public async Task<ApiResult> GetRecentlyReports(QueryRencentlyReportDto condition)
        {
            return await TryCatchAsync(ReportService.GetRencentlyReports(condition));
        }
    }
}